package com.jieao.common.utils.file.constant;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @Description oss配置信息
 * @Author weifanl
 * @Date2021/3/25 18:22
 **/
@Configuration
public class OSSProperty {
    /**
     * 阿里云API的密钥Access Key ID
     */
    public static String accessKeyId;
    /**
     * 阿里云API的密钥Access Key Secret
     */
    public static String accessKeySecret;
    /**
     * 阿里云API的内或外网域名
     */
    public static String endpoint;
    /**
     * 阿里云保存图片的BucketName
     */
    public static String imgBucketName;
    /**
     * 图片BucketName对应cdn
     */
    public static String imgCdn;

    /**
     * 阿里云保存视频的BucketName
     */
    public static String videoBucketName;
    /**
     * 视频BucketName对应cdn
     */
    public static String videoCdn;

    /**
     * 阿里云保存文件的BucketName
     */
    public static String fileBucketName;
    /**
     * 文件BucketName对应cdn
     */
    public static String fileCdn;

    /**
     * 全局表格缩略图
     */
    public static String smallImgSuffix = "?x-oss-process=image/resize,m_fill,h_100,w_100";


    @Value("${aliyun.accessKeyId}")
    public void setAccessKeyId(String accessKeyId) {
        OSSProperty.accessKeyId = accessKeyId;
    }

    @Value("${aliyun.accessKeySecret}")
    public void setAccessKeySecret(String accessKeySecret) {
        OSSProperty.accessKeySecret = accessKeySecret;
    }

    @Value("${aliyun.oss.endpoint}")
    public void setEndpoint(String endpoint) {
        OSSProperty.endpoint = endpoint;
    }

    @Value("${aliyun.oss.imgBucketName}")
    public void setImgBucketName(String imgBucketName) {
        OSSProperty.imgBucketName = imgBucketName;
    }
    @Value("${aliyun.oss.imgCdn}")
    public void setImgCdn(String imgCdn) {
        OSSProperty.imgCdn = imgCdn;
    }

    @Value("${aliyun.oss.videoBucketName}")
    public void setVideoBucketName(String videoBucketName) {
        OSSProperty.videoBucketName = videoBucketName;
    }
    @Value("${aliyun.oss.videoCdn}")
    public void setVideoCdn(String videoCdn) {
        OSSProperty.videoCdn = videoCdn;
    }

    @Value("${aliyun.oss.fileBucketName}")
    public void setFileBucketName(String fileBucketName) {
        OSSProperty.fileBucketName = fileBucketName;
    }

    @Value("${aliyun.oss.fileCdn}")
    public void setFileCdn(String fileCdn) {
        OSSProperty.fileCdn = fileCdn;
    }
}
